<?php
class photo {
	
	public $base;
	//public $upload;
	/**
	 * 类的初始化
	 *
	 * @param oject $base
	 * 加载photo视图
	 * 加载类库upload
	 */
	function __construct($base) {
		$this->base = $base;
		//加载上传视图
	   
	  //  $this->upload = $this->base->loadLib('upload');
	 
	    
	}
	
	public function index() {
		 $this->base->loadView('photo');
	}
	/**
	 * 图片上传函数
	 *
	 */
	public function upload() {
		define('UPLOADDIR',"C:\uploads");
		if (is_uploaded_file($_FILES['image']['tmp_name'])) {
				echo $_FILES['image']['name'];
				echo $_FILES['image']['type'];
				echo $_FILES['image']['tmp_name'];
				echo $_FILES['image']['size'];
				$allowed = array('image/gif','image/jpeg','image/jpg','image/pjpeg');
				if(in_array($_FILES['image']['type'],$allowed)) {
					$result = move_uploaded_file($_FILES['image']['tmp_name'],UPLOADDIR."/{$_FILES['image']['name']}");
					if($result) echo "<p>success</p>";
					else echo "<p>failed</p>";
				} else {
					echo 'no image type';
				}
			}  else {
			echo "<p>no image</p>";
		}
	}
	/**
	 *ajax 创建相册
	 * 
	 */
	function createAlbum() {
		
	echo	$title = $_POST['title'];
	}
}
?>